RNA-Seq Data Analysis ◾ 191
function. The function then creates the MD plot from the specified sample and the arti-
ficial sample. The following script creates the MD plots for the six samples (Figure 5.16):
jpeg(‘mdplots.jpg’)
par(mfrow=c(2,3))
for (i in 1:6) {
plotMD(yNorm, column=i,
xlab=”Average log CPM (all samples)”,
ylab=”log-ratio (this vs others)”)
abline(h=0, col=”red”, lty=2, lwd=2)
}
dev.off()
We can also create boxplots for the unnormalized and normalized log-CPM values to show
the expression distributions in each sample using the following script:
png(file=”logcpmboxplot.png”)
par(mfrow=c(1,2))
logcounts <- cpm(y,log=TRUE)
boxplot(logcounts, xlab=””, ylab=”Log2 counts per million”,las=2)
abline(h=median(logcounts),col=”blue”)
title(“Unnormalized logCPMs”)
logcountsNorm <- cpm(yNorm,log=TRUE)
boxplot(logcountsNorm, xlab=””, ylab=”Log2 counts per
million”,las=2)
abline(h=median(logcountsNorm),col=”blue”)
title(“Normalized logCPMs”)
dev.off()
FIGURE 5.17 The boxplots of normalized log CPM.